﻿@model Leads360Express.Repository.Pages.Reporting.ReturnLeadsModel
@{
    ViewBag.Title = "Return Leads";
    Layout = "~/Views/EmailSummary/_EmailSummaryLayout.cshtml";

    // Local variables
    ViewData["strFrom"] = DateTime.Now.AddDays(-7).ToShortDateString();
    ViewData["strTo"] = DateTime.Now.ToShortDateString() ;
}
<form action="#" class="form" id="returnleadsreport">
    <fieldset>
        <div class="content">
            <div class="error-msg" id="visibleErrormsg" style="display:none; margin-top:-1px" >
                <span>This information is currently not available because of a problem with the network or server.  Please try again in a few moments.</span>
            </div>

            <h2 class="app">
                <strong>Return Leads Report</strong>
                @Html.Partial("_PatialLeads_Calls", @Model.LeadCall )
            </h2>

            <div class="toolbar topblue">
                <span class="area">
                    <div class="select-holder lead-sources spl returnleads">
                        <select id="selectLead" class="editable-select" data-bind='value: Lead, foreach: LeadOptions, optionsCaption: "All Lead Sources"'>
                            <option data-bind="value: LeadSourceId, text: LeadSourceName"></option>
                        </select>
                    </div>
                </span>

                <span class="area">
                    <span class="spl" style=""><strong>Range:</strong></span>
                    <input type="radio" class="radio spl" name="filter" value="false" data-bind="checked: RangeOption" />
                    <div class="select-holder sel-range spl" style="width: 105px;">
                        <select id="selectDate" data-bind='enable: RangeEnable, value: Range, foreach: RangeOptions, optionsCaption: "Today"' style="width: 90px;">
                            <option data-bind="value: RangeValue, text: RangeName"></option>
                        </select>
                    </div>

                    <span class="spl" style="padding-left:5px;"><strong>or</strong></span>
                    <input type="radio" class="radio spl" name="filter" value="true" data-bind="checked: RangeOption" />
                    <label for="txt-from" class="spl" style="font-weight:normal;">From:</label>
                    <input type="text" id="startDate" value= @ViewData["strFrom"]  class="text date spl" data-bind="enable: FromDateEnable" />
                    <label for="txt-from" class="spl" style="font-weight:normal;padding-left:5px;">To:</label>
                    <input type="text" id="endDate" value= @ViewData["strTo"] class="text date" data-bind="enable: ToDateEnable"/>
                </span>

                <span class="area left"><a class="btn btn-go" href="javascript:void(1);" data-bind="click: search" >Go</a></span>
                <span data-bind="visible:!NoResultsFound()">
                    <a class="btn btn-exportexcel right" style="margin-right: 5px;" href='@Url.Action("ExportReturnLeadsToExcel")'>Export to Excel</a>
                </span>
            </div>

            <div data-bind="visible:!NoResultsFound()">
                <span class="paging">
                    <span class="show">Show <input type="text" id="pageshow" class="text" data-bind="value:PageSize , attr: {maxlength: 3}, event: { keypress: RunSomethingKey }" onkeypress="return isNumberKey(event)" value = "10"/> per page <span class="smallText" data-bind="text: PageSizeText"></span> </span>
                    <span class="pages" data-bind="visible: ReportItems().length > 0"><span class="smallText" data-bind="text: PageCurrentText"></span>Page <input type="text" id="pageIndex" class="text" data-bind="value: CurrentPageIndex, event: { keypress: RunSomethingKey2 }" /> of <label data-bind="text:MaxPageIndex"></label>
                        <a href="##" class="btn btn-prev-arrow" data-bind="click: PrevPage ,attr: {'class': PrevButtonClass}"></a>
                        <a href="##" class="btn btn-next-arrow" data-bind="click: NextPage ,attr: {'class': NextButtonClass}"></a>
                    </span>
                </span>

                <div class="table table-leads returnleads">
                    <div class="title">
                        <div class="col1" data-bind='click: function(event) { SetOrder(event, "LeadSource")}'>
                            <span class="w">
                                <a href="#">Lead Source</a>
                                <div class="sort_wrapper" id="LeadSource">
                                    <span class="grid_order ui_icon"></span>
                                </div>
                            </span>
                        </div>
                        <div class="col1 col2" id="DateAdded"><span class="w">Date Added</span></div>
                        <div class="col1 col3" id="RefId"><span class="w">Ref ID</span></div>
                        <div class="col1 col4" id="LeadFirstName"><span class="w">Lead First Name</span></div>
                        <div class="col1 col5" id="LeadLastName"><span class="w">Lead Last Name</span></div>
                        <div class="col1 col6" id="EmailAddress"><span class="w">Email Address</span></div>
                    </div>
                    <div class="linegroup" data-bind=" foreach: ReportItems">
                        <div class="line">
                            <div class="col1" ><span class="w" data-bind='text: LeadSource'></span></div>
                            <div class="col1 col2" ><span class="w" data-bind='text: DateAdded'></span></div>
                            <div class="col1 col3" ><span class="w" data-bind='text: RefId'></span></div>
                            <div class="col1 col4" ><span class="w" data-bind='text: LeadFirstName'></span></div>
                            <div class="col1 col5" ><span class="w" data-bind='text: LeadLastName'></span></div>
                            <div class="col1 col6" ><span class="w" data-bind='text: EmailAddress'></span></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="panel" data-bind="visible:NoResultsFound">
                <div class="error-msg"><span>No results were found.</span></div>
            </div>

            @Html.Partial("_Footer.Copyright")
        </div><!-- //.content -->
    </fieldset>
</form>

<script type="text/javascript">
//<![CDATA[
    var data = @(Html.Raw(Json.Encode(Model)));
//]]>
</script>
<script src="~/Scripts/viewModel/ReturnLeadsReportViewModel.js" type="text/javascript"></script>
